home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / Sources / src / h / keys.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-27  |  5.7 KB  |  224 lines

  1. /*{{{}}}*/
  2. /*{{{  bits per character = 8*/
  3. #define BITS_P_CHAR 8
  4. #define BITS_P_SET_PAKET BITS_P_CHAR/* needs to be a power of 2! */
  5. /*}}}  */
  6. #include <h/token.h>
  7. #include <h/defaults.h>
  8. /*{{{  char-sets*/
  9. #define SET_LG ((1<<BITS_P_CHAR)/BITS_P_SET_PAKET)
  10. typedef unsigned char SetField[SET_LG];
  11.  
  12. #if defined(SET_C) || defined(I_SET_C)
  13.    typedef enum
  14.     { add_new_set= 1,
  15.       first_user_set= 0,
  16.       alpha_set= -1,
  17.       upper_set= -2,
  18.       lower_set= -3,
  19.       digit_set= -4,
  20.       alnum_set= -5,
  21.       blank_set= -6,
  22.       xdigi_set= -7,
  23.       cntrl_set= -8,
  24.       punct_set= -9,
  25.       print_set= -10,
  26.       space_set= -11,
  27.       graph_set= -12,
  28.       undefined_set= -13
  29.     } SetId;
  30. #endif
  31. /*}}}  */
  32. /*{{{  standard-marks*/
  33. #define FOLD_TAG_LENGTH 3
  34. #define PSEUDO_MARK    "   "
  35. #define LINE_STANDARD  "..."
  36. #define BEGIN_STANDARD "{{{"
  37. #define FILE_STANDARD  ":::"
  38. #define END_STANDARD   "}}}"
  39. /*}}}  */
  40. /*{{{  compressed KEY structure and access*/
  41. #if defined(INIT_C) || defined (KEYTAB_C) || defined(VIEW_MAIN_C)
  42.    /*{{{  KEY*/
  43.    typedef struct
  44.     { TOKEN code;
  45.       unsigned char key;
  46.       unsigned char flags;
  47.     } KEY;
  48. #   define NOT_USED   0
  49. #   define NEXT_USED  1
  50. #   define LEVEL_USED 2
  51. #   define MAGIC_KEY  4
  52. #   define FAR_NEXT   8
  53.    /*}}}  */
  54.    /*{{{  key_level_ptr*/
  55. #   define key_level_ptr(x) \
  56.       (((x) && (x)->flags&LEVEL_USED) \
  57.        ? ((x)+(x)->code)             \
  58.         : (KEY*)0)
  59.    /*}}}  */
  60.    /*{{{  key_next_ptr*/
  61. #   define key_next_ptr(x) \
  62.       ((x) && ((x)->flags&NEXT_USED) \
  63.        ? ((x)+1)                     \
  64.        : (KEY*)0)
  65.    /*}}}  */
  66.    /*{{{  key_far_next*/
  67. #   define key_far_next(x) ((x)&&((x)->flags&FAR_NEXT))
  68.    /*}}}  */
  69.    /*{{{  key_match*/
  70. #   define key_match(x,c) ((x) && ((x)->flags&MAGIC_KEY || (x)->key==(c)))
  71.    /*}}}  */
  72.    /*{{{  key_code*/
  73. #   define key_code(x) ((!(x) || (x)->flags&LEVEL_USED)?0:((x)->code))
  74.    /*}}}  */
  75.    /*{{{  set_key_data*/
  76. #   define set_key_data(p,f) \
  77.       ((p)->code=rc_get_w(f),(p)->key=rc_get_c(f),(p)->flags=rc_get_c(f))
  78.    /*}}}  */
  79.    /*{{{  put_key_data*/
  80. #   define put_key_data(p,f) \
  81.       (rc_put_w((p)->code,(f)),rc_put_c((p)->key,(f)),rc_put_c((p)->flags,(f)))
  82.    /*}}}  */
  83. #endif
  84. /*}}}  */
  85. /*{{{  histories*/
  86. typedef enum
  87.  { unknown_history=0,
  88.    default_history,
  89.    no_history,
  90.    misc_history,
  91.    file_history,
  92.    shell_history,
  93.    search_history,
  94.    replace_history,
  95.    error_history,
  96.    arg_history,
  97.    match_history,
  98.    nomatch_history,
  99.    user_history
  100.  } histories;
  101. /*}}}  */
  102. /*{{{  rc-constants*/
  103. #ifdef BIND_CONST
  104. #  undef BIND_CONST
  105.  
  106.   /*{{{  indices*/
  107.   typedef enum
  108.    {
  109.      /*{{{  sizes*/
  110.      i_m_count,
  111.      i_v_count,
  112.      i_k_count,
  113.      /*}}}  */
  114.      /*{{{  vars*/
  115.      i_v_cur_lev,
  116.      i_v_scr_h,
  117.      i_v_off_h,
  118.      i_v_scr_w,
  119.      i_v_off_w,
  120.      i_v_ocl_arg,
  121.      i_v_file_no,
  122.      i_v_us_buff,
  123.      i_v_cu_buff,
  124.      i_v_cu_b_id,
  125.      i_v_m_edit,
  126.      i_v_mod_beh,
  127.      i_v_key_count,
  128.      i_v_kill_count,
  129.      i_v_move_count,
  130.      i_v_path,
  131.      i_v_m_x,
  132.      i_v_m_y,
  133.      i_v_m_gy,
  134.      i_v_m_but,
  135.      i_v_m_buff,
  136.      i_v_m_out,
  137.      i_v_dired,
  138.      i_v_force_sh,
  139.      /*}}}  */
  140.      /*{{{  switches*/
  141.      i_v_notitle,
  142.      i_arg_list,
  143.      /*}}}  */
  144.      /*{{{  specials*/
  145.      i_general_abort_key,
  146.      i_comma,
  147.      i_lineend,
  148.      i_linestart,
  149.      /*}}}  */
  150.      /*{{{  hooks*/
  151.      i_auto_macro,
  152.      i_abort_macro,
  153.      i_pin_macro,
  154.      i_pout_macro,
  155.      i_knb_macro,
  156.      i_view_macro,
  157.      i_buff_macro,
  158.      i_quit_macro,
  159.      i_usr1_macro,
  160.      i_usr2_macro,
  161.      i_alarm_macro,
  162.      /*}}}  */
  163.      RCC_SIZE
  164.    } b_c_offset;
  165.   /*}}}  */
  166.   /*{{{  defines for const access*/
  167.   /*{{{  sizes*/
  168. #  define mac_count (bind_const[i_m_count])
  169. #  define var_count (bind_const[i_v_count])
  170. #  define ktb_count (bind_const[i_k_count])
  171.   /*}}}  */
  172.   /*{{{  vars*/
  173. #  define var_cur_lev (bind_const[i_v_cur_lev])
  174. #  define var_scr_h (bind_const[i_v_scr_h])
  175. #  define var_off_h (bind_const[i_v_off_h])
  176. #  define var_scr_w (bind_const[i_v_scr_w])
  177. #  define var_off_w (bind_const[i_v_off_w])
  178. #  define var_ocl_arg (bind_const[i_v_ocl_arg])
  179. #  define var_file_no (bind_const[i_v_file_no])
  180. #  define var_us_buff (bind_const[i_v_us_buff])
  181. #  define var_cu_buff (bind_const[i_v_cu_buff])
  182. #  define var_cu_b_id (bind_const[i_v_cu_b_id])
  183. #  define var_m_edit (bind_const[i_v_m_edit])
  184. #  define var_mod_beh (bind_const[i_v_mod_beh])
  185. #  define var_key_count (bind_const[i_v_key_count])
  186. #  define var_kill_count (bind_const[i_v_kill_count])
  187. #  define var_move_count (bind_const[i_v_move_count])
  188. #  define var_path (bind_const[i_v_path])
  189. #  define var_m_x (bind_const[i_v_m_x])
  190. #  define var_m_y (bind_const[i_v_m_y])
  191. #  define var_m_gy (bind_const[i_v_m_gy])
  192. #  define var_m_but (bind_const[i_v_m_but])
  193. #  define var_m_buff (bind_const[i_v_m_buff])
  194. #  define var_m_out (bind_const[i_v_m_out])
  195. #  define var_dired (bind_const[i_v_dired])
  196. #  define var_force_sh (bind_const[i_v_force_sh])
  197.   /*}}}  */
  198.   /*{{{  switches*/
  199. #  define var_notitle (bind_const[i_v_notitle])
  200. #  define arg_list (bind_const[i_arg_list])
  201.   /*}}}  */
  202.   /*{{{  specials*/
  203. #  define general_abort_key (bind_const[i_general_abort_key])
  204. #  define comma (bind_const[i_comma])
  205. #  define eoln_str (bind_const[i_lineend])
  206. #  define soln_str (bind_const[i_linestart])
  207.   /*}}}  */
  208.   /*{{{  hooks*/
  209. #  define auto_macro (bind_const[i_auto_macro])
  210. #  define abort_macro (bind_const[i_abort_macro])
  211. #  define pin_macro (bind_const[i_pin_macro])
  212. #  define pout_macro (bind_const[i_pout_macro])
  213. #  define knb_macro (bind_const[i_knb_macro])
  214. #  define view_macro (bind_const[i_view_macro])
  215. #  define buff_macro (bind_const[i_buff_macro])
  216. #  define squit_macro (bind_const[i_quit_macro])
  217. #  define susr1_macro (bind_const[i_usr1_macro])
  218. #  define susr2_macro (bind_const[i_usr2_macro])
  219. #  define salarm_macro (bind_const[i_alarm_macro])
  220.   /*}}}  */
  221.   /*}}}  */
  222. #endif
  223. /*}}}  */
  224.